# 定义一个字符串
str_names = "tom jack mary none smith hsp 1老韩"
#统计一共有多少个人名
str_names_arr = str_names.split(" ")
print(f"一共有{len(str_names_arr)}个人")

#如果有"hsp",则替换成老韩
str_names_replace = str_names.replace("hsp" , "老韩")
print(str_names_replace)

#如果人名是英文,则把首字母改成大写
str_names_new = ""
for elem in str_names_arr:
    #如果全部是字母的话
    if elem.isalpha():
        #首字母转化为大写
        elem_temp = elem.capitalize()
    else:
        elem_temp = elem
    str_names_new += elem_temp + " "
str_names_new = str_names_new.strip(" ")
print(str_names_new)

